<template>
  <div id="app">
    <header>
      <h1>数据可视化-Echarts</h1>
      <div class="showTime">{{nowDate}}</div>
    </header>
    <div class="mainbox">
      <div class="column">
        <div class="panel">
          <h2>柱形图-就业行情</h2>
          <div class="chart">图表</div>
          <div class="panel-footer"></div>
        </div>
        <div class="panel">
          <h2>柱形图-就业行情</h2>
          <div class="chart">图表</div>
          <div class="panel-footer"></div>
        </div>
        <div class="panel">
          <h2>柱形图-就业行情</h2>
          <div class="chart">图表</div>
          <div class="panel-footer"></div>
        </div>
      </div>
      <div class="column">
        <div class="no">
          <div class="no-hd">
            <ul>
              <li>123456</li>
              <li>100000</li>
            </ul>
          </div>
          <div class="no-bd">
            <ul>
              <li>前端供应人才数量</li>
              <li>市场需要人才数量</li>
            </ul>
          </div>
        </div>
        <div class="map">
          <div class="map1"></div>
          <div class="map2"></div>
          <div class="map3"></div>
        </div>
      </div>
      <div class="column">
        <div class="panel">
          <h2>柱形图-就业行情</h2>
          <div class="chart">图表</div>
          <div class="panel-footer"></div>
        </div>
        <div class="panel">
          <h2>柱形图-就业行情</h2>
          <div class="chart">图表</div>
          <div class="panel-footer"></div>
        </div>
        <div class="panel">
          <h2>柱形图-就业行情</h2>
          <div class="chart">图表</div>
          <div class="panel-footer"></div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'

export default {
  name: 'App',
  components: {

  },
  data(){
    return {
      nowDate: "", // 当前日期
    };
  },
  methods:{
    currentTime() {
      setInterval(this.formatDate, 500);
    },
    formatDate() {
      let date = new Date();
      let year = date.getFullYear(); // 年
      let month = date.getMonth() + 1; // 月
      let day = date.getDate(); // 日
      let week = date.getDay(); // 星期
      let weekArr = [ "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" ];
      let hour = date.getHours(); // 时
      hour = hour < 10 ? "0" + hour : hour; // 如果只有一位，则前面补零
      let minute = date.getMinutes(); // 分
      minute = minute < 10 ? "0" + minute : minute; // 如果只有一位，则前面补零
      let second = date.getSeconds(); // 秒
      second = second < 10 ? "0" + second : second; // 如果只有一位，则前面补零
      this.nowDate = `${year}/${month}/${day} ${hour}:${minute}:${second} ${weekArr[week]}`;
    }
  },
  mounted() {
    this.currentTime();
  },
  // 销毁定时器
  beforeDestroy() {
    if (this.formatDate) {
      clearInterval(this.formatDate); // 在Vue实例销毁前，清除时间定时器
    }
  }
}
</script>

<style lang="less">
*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
ul{
  list-style: none;
}
/* 声明字体*/
@font-face {
  font-family: electronicFont;
  src: url(/lib/font/DS-DIGIT.TTF);
}
#app {
  width: 100%;
  line-height: 1.15; 
  background: url("/lib/images/bg.jpg") no-repeat top center;
}
header{
  position: relative;
  height: 1.25rem;
  background: url("/lib/images/head_bg.png") no-repeat;
  background-size: 100% 100%;
  h1{
    color: #fff;
    font-size: .475rem;
    text-align: center;
    line-height: 1rem;
  }
  .showTime{
    position: absolute;
    top: 0;
    right: .375rem;
    line-height: .9375rem;
    color: rgba(255, 255, 255, 0.7) ;
    font-size: .25rem;
  }
}
.mainbox{
  display: flex;
  max-width: 24rem;
  min-width: 12.8rem;
  margin: 0 auto;
  padding: .125rem .125rem 0;
  .column{
    flex: 3;
  }
  .column:nth-child(2){
    flex: 5;
    margin: 0 .125rem .1875rem;
    .no{
      background-color: rgba(101, 132, 226, 0.1);
      padding: .1875rem;
      .no-hd{
        border: 1px solid rgba(25, 186, 139, 0.17);
        ul{
          display: flex;
          position: relative;
          &::after{
            content: '';
            position: absolute;
            width: 0.375rem;
            height: 0.125rem;
            top: 0;
            left: 0;
            border-top: 2px solid #02a6b5;
            border-left: 2px solid #02a6b5;
          }
          &::before{
            content: '';
            position: absolute;
            width: 0.375rem;
            height: 0.125rem;
            bottom: 0;
            right: 0;
            border-bottom: 2px solid #02a6b5;
            border-right: 2px solid #02a6b5;
          }
          li{
            position: relative;
            flex: 1;
            line-height: 1rem;
            font-size: 0.875rem;
            color: #ffeb7b;
            font-family: electronicFont;
            text-align: center;
            &:first-child:after{
              position: absolute;
              content: '';
              width: 1px;
              height: 50%;
              top: 25%;
              right: 0;
              background-color:  rgba(255, 255, 255, 0.2);
            }
          }
        }  
      }
      .no-bd{
        ul{
          display: flex;
          li{
            flex: 1;
            line-height: 0.5rem;
            color:  rgba(255, 255, 255, 0.7);
            font-size: 0.225rem;
            padding-top: 10px;
            text-align: center;
          }
        }
      }
    }
    .map{
      position: relative;
      height: 10.125rem;
      .map1,
      .map2,
      .map3,
      {
        width: 6.475rem;
        height: 6.475rem;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%,-50%);
        background-image: url(/lib/images/map.png);
        background-size: 100% 100%;
        opacity: .3;
        z-index: 1;
      }
      .map2{
        width: 8.0375rem;
        height: 8.0375rem;
         
        background-image: url(/lib/images/lbx.png);
         
        opacity: .6;
        z-index: 2;
        animation: rotate 15s linear infinite;
      }
      .map3{
        width: 7.075rem;
        height: 7.075rem;
         
        background-image: url(/lib/images/jt.png);
        background-size: 100% 100%;
        
        z-index: 3;
        animation: rotate1 10s linear infinite;
      }
      @keyframes rotate {
        from{
            transform: translate(-50%, -50%) rotate(0deg);
        }
        to{
            transform: translate(-50%, -50%) rotate(360deg);
        }
      }
      @keyframes rotate1 {
        from{
            transform: translate(-50%, -50%) rotate(0deg);
        }
        to{
            transform: translate(-50%, -50%) rotate(-360deg);
        }
      }
    }
  }
  .panel{
    position: relative;
    // height: 3.875rem;
    border: 1px solid rgba(25, 186, 139, 0.17);
    background: url('/lib/images/line(1).png') no-repeat center;
    padding: 0 .1875rem .5rem;
    margin-bottom: .1875rem;
    &::before{
      position: absolute;
      content: '';
      width: 10px;
      height: 10px;
      top: 0;
      left: 0;
      border: 2px solid #02a6b5;
      border-right: none;
      border-bottom: none;
    }
    &::after{
      position: absolute;
      content: '';
      width: 10px;
      height: 10px;
      top: 0;
      right: 0;
      border: 2px solid #02a6b5;
      border-left: none;
      border-bottom: none;
    }
    .panel-footer{
      position: absolute;
      width: 100%;
      height: 10px;
      bottom: 0;
      left: 0;
      &::before{
      position: absolute;
      content: '';
      width: 10px;
      height: 10px;
      top: 0;
      left: 0;
      border: 2px solid #02a6b5;
      border-right: none;
      border-top: none;
    }
    &::after{
      position: absolute;
      content: '';
      width: 10px;
      height: 10px;
      top: 0;
      right: 0;
      border: 2px solid #02a6b5;
      border-left: none;
      border-top: none;
    }
    }
    h2{
      height: .6rem;
      line-height: .6rem;
      color: #fff;
      text-align: center;
      font-size: .25rem;
      font-weight: 400;
    }
    .chart{
      height: 3rem;
      background-color: pink;
    }
  }
}
</style>
